package com.yupi.cli.pattern;

public class Client {
    public static void main(String[] args) {
        Device a = new Device("a");
        Device b = new Device("b");
        //创建命令对象
        TurnOnCommand turnOn = new TurnOnCommand(a);
        TurnOffCommand turnOff = new TurnOffCommand(b);

        //创建调用者
        RemoteControl remoteControl = new RemoteControl();

        //执行命令
        remoteControl.setCommand(turnOn);
        remoteControl.press();

        remoteControl.setCommand(turnOff);
        remoteControl.press();

    }

}
